﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PPI.WebConsumer;

namespace PPI.Client.Logic
{
    public class LDeploy
    {
        public static string StartDeployGPS(int utilityId, string utilityName, int vendorId, string vendorName, int projectId, string projectName, int contactId, string contactName, int handheldId, string handheldName, string mobileVersion)
        {
            string downloadDatabase =  WDeploy.StartDeployGPS(utilityId,utilityName,vendorId,vendorName,projectId,projectName,contactId,contactName,handheldId,handheldName,mobileVersion);
            return downloadDatabase;
        }

        public static string StartDeployInspection(int handheldId, string handheldName, int inspectorId, string inspectorName, int companyId, string companyName, string mobileVersion, int vendorId, string vendorName, int projectId, string projectName, int contactId, string contactName)
        {
            string downloadDatabase = WDeploy.StartDeployInspection(handheldId,handheldName,inspectorId,inspectorName,companyId,companyName,mobileVersion,vendorId,vendorName,projectId,projectName,contactId,contactName);
            return downloadDatabase;
        }
        public static string StartDeployProject(int handheldId, string handheldName,string mobileVersion)
        {
            string downloadDatabase = WDeploy.StartDeployProject(handheldId, handheldName, mobileVersion);
            return ParseDownloadDatabase(downloadDatabase);
        }

        public static string StartDeployDistribution(int distributionAppMode)
        {
            string downloadDatabase = WDeploy.StartDeployDistribution(distributionAppMode);

            return ParseDownloadDatabase(downloadDatabase);
        }

        public static string StartDeployDistribution(int vendorId, string vendorName, int vendorContactId, string vendorContactName, int distributionAppMode, int vendorProjectId, int utilityId, string utilityName)
        {
            string downloadDatabase = WDeploy.StartDeployDistribution(vendorId, vendorName, vendorContactId, vendorContactName, distributionAppMode, vendorProjectId, utilityId, utilityName);

            return ParseDownloadDatabase(downloadDatabase);            
        }
            

        public static string ParseDownloadDatabase(string sourceDatabase)
        {
            sourceDatabase = sourceDatabase.Replace(Constants.K_SERVERBASEFODLER, Constants.K_SERVERBASEURL);
            sourceDatabase = sourceDatabase.Replace("\\", "/");
            return sourceDatabase;
        }
    }
}
